package com.fang.gateway.handle;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;

import java.util.Date;

/**
 * @Description
 * @Author Bernie_fang
 * @Date 2024/12/9 22:35
 **/
public class MyMateObjectHandle implements MetaObjectHandler {
    //插入时的填充策略
    @Override
    public void insertFill(MetaObject metaObject) {
        // log.info("start insert fill......");
        this.setFieldValByName("createTime", new Date(), metaObject);
        this.setFieldValByName("modifiedTime", new Date(), metaObject);
        // this.setFieldValByName();
    }

    //更新时的填充策略
    @Override
    public void updateFill(MetaObject metaObject) {
        // log.info("start update fill......");
        this.setFieldValByName("modifiedTime", new Date(), metaObject);
    }
}
